package company.permissionsystem.security;


import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

@Setter
public class SystemUserDetails implements UserDetails {

    private String username;    //密码
    private String password;    //用户名
    boolean status;    //账号是否可用
    Collection<? extends GrantedAuthority> authorities;     //用户的权限集合

    boolean accountNonExpired;  //账号是否过期
    boolean accountNonLocked;   //账号是否被锁定
    boolean credentialsNonExpired;  //密码是否过期

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return status;
    }


}
